home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pctsort2.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1984-04-24  |  1.7 KB  |  36 lines

  1. 10  '*************************************************************************
  2. 20  '* For sorting DIALING DIRECTORY (PC-TALK.DIR) for PC-TALK  ver. III.    *
  3. 30  '*   written  by Jung W. Woo, Arlington, Va.              June, 1983.    *
  4. 40  '* This program also deletes unwanted items from the directory.  Just    *
  5. 50  '*   enter five dashes ("-----") in the name field before running.       *
  6. 60  '*************************************************************************
  7. 70  '
  8. 80  'modified by Joe Collins, 4/1/84 to allow select sort on Area Code or Name
  9. 90  '
  10. 91  OPTION BASE 1:DEFINT A-Z:DIM W$(60),SRT$(60)
  11. 92  SO$(1)="Name/Number":SO$(2)="Number/Name"
  12. 100  CLS:KEY OFF
  13. 110  LOCATE 1,30:PRINT "Sort PC-Talk Directory"
  14. 120  LOCATE 3,1:PRINT SPACE$(80)
  15. 130  LOCATE 3,3:INPUT "Sort by Name/Number or Number/Name (1 or 2) ";SO
  16. 140  IF SO<1 OR SO>2 THEN BEEP:GOTO 120
  17. 170  PRINT:PRINT"Sorting PC-TALK.DIR by " SO$(SO) " .";
  18. 180  ON ERROR GOTO 330:OPEN"PC-TALK.DIR" AS #1
  19. 190  FIELD #1,5 AS CK$:FIELD #1,104 AS RR$
  20. 200  FIELD #1,24 AS N$,36 AS R$,2 AS X$,4 AS B$,5 AS P$,2 AS T$,26 AS C$,3 AS L$,2 AS G$
  21. 205  FIELD #1,46 AS DMY$,14 AS S2$
  22. 210  GET#1,1:IF LEFT$(N$,10)<>"INITIALIII"THEN 320
  23. 220  I=5:J=0
  24. 230  GET#1,I
  25. 235  IF CK$<>"-----" THEN J=J+1:W$(J)=RR$:IF SO=1 THEN SRT$(J)=RR$                                                                ELSE SRT$(J)=S2$
  26. 250  I=I+1:IF I<65 THEN 230
  27. 260  F=1:I=1:PRINT".";
  28. 270  IF SRT$(I)>SRT$(I+1)THEN SWAP W$(I),W$(I+1):SWAP SRT$(I),SRT$(I+1):F=0
  29. 280  I=I+1:IF I<J THEN 270
  30. 290  IF F=0 THEN 260
  31. 300  FOR I=1 TO J:LSET RR$=W$(I):PUT#1,I+4:NEXT:LSET N$="------------------------":RSET R$="- --- --- ----":LSET X$=MKI$(14):RSET B$="300":LSET P$="E71NN":LSET T$=MKI$(O):LSET C$=STRING$(26,"/"):LSET L$="":LSET G$=MKI$(0):FOR I=J+5 TO 64:PUT#1,I:NEXT
  32. 310  CLOSE:BEEP:PRINT" done !":END
  33. 320  BEEP:PRINT"PC-TALK.DIR not initialized.":CLOSE:END
  34. 330  CLOSE:IF ERL=180 THEN PRINT"PC-TALK.DIR not found.":RESUME 340
  35. 340  END
  36.